<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <title>审核</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %> 
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>审核</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">合同管理</a></li>
            <li class="active"><a href="#">合同审核</a></li>
        </ol>
    </section>
    <section class="content">
        <div class=" box box-success">
            <!-- form start -->
            <form role="form" class="form-horizontal" action="bakDrugList.jsp" method="post">
                <div class="box-body">
                    <div class="form-group form-group-xs">
                        <label for="contractName" class="col-sm-2 text-right">合同名称：</label>
                        <div class="col-sm-3 text-left">${contract.contractTitle}</div>
                        <label for="project" class="col-sm-2 text-right">所属项目：</label>
                        <div class="col-sm-3 text-left">${projName }</div>
                    </div>
                    <div class="line"></div>
                     <div class="form-group form-group-xs">
                        <label for="partyA" class="col-sm-2 text-right">合同甲方：</label>
								<div class="col-sm-3 text-left">${contractPartyA}</div>
								<label for="partyB" class="col-sm-2 text-right">合同乙方：</label>
                            <c:forEach items="${contractPartyBNames}" var="partyName">
                                <div class="col-sm-3 text-left">${partyName}</div>
                            </c:forEach>
                    </div>
                    <div class="line"></div> 
	                <div id="documentviewer" class="flexpaper_viewer" style="margin-left:150px;width:800px;height:700px;display:block">Document loading..
	                </div>  
	                <div class="form-group form-group-xs">
	                     <label for="name" class="col-sm-2 text-right">审核备注：</label>
	                         <div class="col-sm-9">
	                            <textarea class="form-control" rows="3" id="auditRemark" name="auditRemark" placeholder="审核备注"></textarea>
	                        </div>
	                    </div>
	                    <input type="hidden" id="contractId" value="${contractId }"></input>
                </div>
                <div class=" box box-warning bottongroup">
                	<a onclick ="audit(2)" class="btn btn-success btn-sm">通&nbsp;过</a>
               	    <a onclick ="audit(3)" class="btn btn-success btn-sm">不通过</a>
                    <a href="toBidContractAudit.html" class="btn btn-danger btn-sm">返&nbsp;回</a>
                </div>
            </form>
        </div>
    </section>
      <%@ include file="/WEB-INF/component/commonJS.jsp" %>  
      <script src="${ctx}/lib/js/flexpaper.js"></script>
    <script type="text/javascript">
	    function audit(auditStatus){
	    	var contractId = $("#contractId").val();
	    	var message ="审核通过";
	    	var auditRemark = $.trim($("#auditRemark").val());
	    	if(auditStatus==3){
	    		message="审核不通过";
	    		if (auditRemark == null || auditRemark == "") {
	    			$.HN.message.alert("请输入审核备注！", "消息", "warn");
	    			return;
	    		}
	    	}
	    	$.HN.message.confirm("确定"+message+"吗？", '', '').on(function (e) {
                if (e) {
                    $.ajax({
                        type:"POST",
                        url:"${ctx}/contract/contractAudit.html",
                        data:{"auditStatus":auditStatus,"contractId":contractId,"auditRemark":auditRemark},
                        dataType:"json",
                        success:function(returnData){
                            if (returnData.success == true) {
                                $.HN.message.alert("操作成功！", "消息", "success", function() {
                                	history.go(-1);
                                });
                            } else {
                                $.HN.message.alert("操作失败！", "消息", "error");
                            }
                        }
                    });
                }
            });
	    }
	    
	    $('#documentviewer').FlexPaperViewer({
			config: {
				SWFFile:"${ctx}/${contract.swfFilePath}",
				Scale:1,
				ZoomTransition:'easeOut',
				ZoomTime:0.50,
				ZoomInterval:0.2,
				FitPageOnLoad:true,
				FitPageWidthOnLoad:true,
				FullScreenAsMaxWindow:false,
				ProgressiveLoading:true,
				MinZoomSize:0.5,
				MaxZoomSize:2,
				SearchMatchAll:false,
				InitViewMode:'TwoPage',
				RederingOrder:'pdf',
				StartAtPage:'',
				ViewModeToolsVisible:true,
				ZoomToolsVisible:true,
				NavToolsVisible:true,
				CursorToolsVisible:false,
				SearchToolsVisible:true,
				WMode : 'window',
				localeChain:'zh_CN'
			}
		});
    </script>
</body>
</html>
